<script setup lang="ts">
import Shop from "@/components/Shop.vue";
import {type IUser} from "@/types";
import {ref, watchEffect} from 'vue'
import ShopHeader from "@/components/ShopHeader.vue";

let userCar = ref<IUser>(JSON.parse(localStorage.getItem("userCar") as string));
watchEffect(() => {
    localStorage.setItem('userCar', JSON.stringify(userCar.value))
})
</script>

<template>
    <ShopHeader/>
    <ul class="list">
        <li v-for="shopData in userCar.carList" :key="shopData.sid">
            <Shop :shopData="shopData"/>
        </li>
    </ul>
</template>

<style scoped>
.list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
</style>